#pragma once
#include "Frame.h"
#include "Bus.h"

enum NodeStatus
{
	Sending,
	Receiving,
	Listening
};

class Node
{
private:
	Frame* mOutboundFrame;
	Frame* mInboundFrame;
	NodeStatus mStatus;
	int mBitIndex;
	bool mLastSentBit;
	bool mIdenticalValue;
	int mConsecutiveCount;

public:
	Node();
	~Node();
	void prepareSending();
	void cancelSending();
	void finishSending();
	void sendOneBit();
	void sendStuffBit();
	bool isLastBitSentOut();
	void run();
	Frame* getOutboundFrame();
	void setOutboundFrame(Frame*);
	Frame* getInboundFrame();
	void setInboundFrame(Frame*);
	void sendNextBit(int);
	
	void prepareReceiving();
	//bool validateFrame();
};